// 路由文件
import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../views/login'
import register from '../views/register'
import middle from '../views/middle'
import bookInfo from '../views/bookInfo'
import shoppingCar from '../views/shoppingCar'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/middle'
  },
  {
    path: '/login',
    name: 'login',
    component: login
  },
  {
    path: '/register',
    name: 'register',
    component: register
  },
  {
    path: '/middle',
    name: 'middle',
    component: middle
  },
  {
    path: '/middle/bookInfo/:id',
    name: 'bookInfo',
    component: bookInfo
  },
  {
    path: '/middle/shoppingCar',
    name: 'shoppingCar',
    component: shoppingCar
  }
]

const router = new VueRouter({
  routes
})

export default router
